<script setup lang="ts">
const text = defineProps([
  "title",
  "lefeText",
  "rightText",
  "fixed",
  "ifText",
  "isStart",
  "textRight",
  "ifToHome",
]);
function handleClickLeft() {
  if (text.ifToHome) {
    uni.switchTab({ url: "/" });
  } else {
    uni.navigateBack();
  }
}
</script>

<template>
  <wd-navbar
    placeholder
    :fixed="text.fixed"
    :title="text.title"
    :left-text="text.lefeText"
    left-arrow
    @click-left="handleClickLeft"
  >
    <!-- 文字 -->
    <template v-if="text.ifText" #right>
      {{ text.rightText }}
    </template>
    <!-- 图片 -->
    <template v-else #right>
      <img
        :src="
          text.isStart
            ? '/src/static/zhqImg/start_active@1x-1.png'
            : '/src/static/zhqImg/start_defaul@1x.png'
        "
        alt=""
      />
      <img src="/src/static/zhqImg/share@1x.png" alt="" />
    </template>
  </wd-navbar>
</template>

<style lang="scss" scoped>
:deep(.wd-navbar__right) {
  color: #31b7a7;
}

:deep(.wd-navbar__title) {
  font-size: 30rpx !important;
}

img {
  width: 40rpx;
  height: 40rpx;
  margin-right: 30rpx;
}
</style>
